package com.sunny.ynhz.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.amap.api.maps.model.Text;
import com.sunny.ynhz.R;
import com.sunny.ynhz.bean.CurrentRiverBean;

import java.util.List;

/**
 * Created by huhuan123 on 2018/9/5.
 *
 * @describe TODO
 */

public class CurrentRiverAdapter extends BaseAdapter {
    Context context;
    List<Object> mList;

    public CurrentRiverAdapter(Context context, List<Object> mList) {
        this.context = context;
        this.mList = mList;
    }

    @Override
    public int getCount() {
        return mList == null ? 0 : mList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        View contentView = LayoutInflater.from(context).inflate(R.layout.item_current_river, null);
        TextView tv_current_river = contentView.findViewById(R.id.tv_current_river);
        Object object = mList.get(i);
        if (object instanceof CurrentRiverBean.DatecountBean) {
            tv_current_river.setTextColor(Color.BLACK);
            CurrentRiverBean.DatecountBean datecountBean = (CurrentRiverBean.DatecountBean) object;
            tv_current_river.setText(datecountBean.getNAME());

        } else {
            tv_current_river.setTextColor(Color.BLUE);
            CurrentRiverBean.DataBean datecountBean = (CurrentRiverBean.DataBean) object;
            tv_current_river.setText(datecountBean.getNAME());
        }

        return contentView;
    }
}
